//
//  LLBBaseNavigationController.swift
//  LLBBaseVC
//
//  Created by Yun on 2018/11/1.
//

import UIKit

open class LLBBaseNavigationController: UINavigationController {

    override open func viewDidLoad() {
        super.viewDidLoad()

    }
    
    override open func pushViewController(_ viewController: UIViewController, animated: Bool) {
        super.pushViewController(viewController, animated: animated)
        self.interactivePopGestureRecognizer?.delegate = nil
    }
    
    public func navigationController(_ navigationController: UINavigationController,
                                     animationControllerFor operation: UINavigationController.Operation,
                                     from fromVC: UIViewController,
                                     to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
        if operation == .push, let vc = toVC as? LLBBaseViewController {
            return vc.pushAnimator()
        }
        if operation == .pop, let vc = fromVC as? LLBBaseViewController {
            return vc.popAnimator()
        }
        return nil
    }

}
